<template>
  <div>
    <el-breadcrumb>
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item v-breadcrumb-certify></el-breadcrumb-item>
    </el-breadcrumb>
    <div class="content">
      <heading grade="1">赛事历史</heading>
      <match-list v-if="history_list && history_list.list && history_list.list.length" :data="history_list.list" :to="to"/>
      <placeholder v-else text="没有赛事历史，先发布赛事吧"/>
      <el-pagination
        v-bind="getPaginationProps(history_list)"
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  import { mapGetters } from 'vuex'
  import MatchList from '../race/components/MatchList'
  import { pagingList } from 'utils/mixins'
  export default {
    mixins: [pagingList],
    components: {
      MatchList
    },
    computed: {
      ...mapGetters({
        history_list: 'history_list'
      })
    },
    data () {
      return {
        query: this.getQuery()
      }
    },
    methods: {
      to (item) {
        return {
          path: '/history/detail/index',
          query: {
            id: item.id,
            tasktype: (item.joinRequire === 20002 || item.joinRequire === 20004) ? 'team' : 'single'
          }
        }
      },
      fetch (query) {
        var org = this.$route.query.authOrgId ? this.$route.query.authOrgId : ''
        this.$store.dispatch('history_list', Object.assign({}, {authOrgId: org}, query))
      }
    }
  }
</script>

<style scoped lang="scss">

</style>
